package sdk.pay.model;

import java.util.Date;

import sdk.pay.utils.PayLogUtil;

/**
 * Created by Joe on 2017/6/9 0009 17:58.
 * TimeDataModel
 */

public class TimeDataModel {
    private Date startDate = null;
    private Date endDate = null;
    private String extraMessage = "";

    @Override
    public String toString() {
        return "TimeDataModel{" +
                "startDate=" + startDate +
                ", endDate=" + endDate +
                ", extraMessage='" + extraMessage + '\'' +
                '}';
    }

    public void initModelData() {
        this.startDate = null;
        this.endDate = null;
        this.extraMessage = "";

    }

    public String getCostTime() {
        try {
            return String.valueOf((double) (this.endDate.getTime() - this.startDate.getTime()) / 1000);
        } catch (Exception e) {
            e.printStackTrace();
            PayLogUtil.logFifth("sql date value error");
            return "-1";//costTime calculation error
        }
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getExtraMessage() {
        return extraMessage;
    }

    public void setExtraMessage(String extraMessage) {
        this.extraMessage = extraMessage;
    }
}
